package ai.people.netmon.msgsearch.mapstruct;

import ai.people.netmon.framework.domain.searchmsg.vo.FbListRespFieldsVO;
import ai.people.netmon.framework.domain.searchmsg.vo.InformationSearchListRespVO;
import ai.people.netmon.msgsearch.domain.entity.FacebookAccountRegisterInfo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper(componentModel = "spring")
public interface FbInformationSearchListRespConverter {

    @Mappings({
            @Mapping(source = "uid", target = "dataId"),
            @Mapping(source = "firstName", target = "fields.firstName"),
            @Mapping(source = "lastName", target = "fields.lastName"),
            @Mapping(source = "phone", target = "fields.phone"),
            @Mapping(source = "uid", target = "fields.uid"),
            @Mapping(target = "fields.platform", constant = "Facebook")
    })
    InformationSearchListRespVO<FbListRespFieldsVO> infoData2Vo(FacebookAccountRegisterInfo infoData);

    @Mappings({
            @Mapping(source = "uid", target = "dataId"),
            @Mapping(source = "firstName", target = "fields.firstName"),
            @Mapping(source = "lastName", target = "fields.lastName"),
            @Mapping(source = "phone", target = "fields.phone"),
            @Mapping(source = "uid", target = "fields.uid"),
            @Mapping(target = "fields.platform", constant = "Facebook")
    })
    List<InformationSearchListRespVO<FbListRespFieldsVO>> infoDataList2VoList(List<FacebookAccountRegisterInfo> infoDataList);

}
